

---获取MySQLSubsystem
function GetMySQLSub(...)
    return UE4.UUMGLibrary.GetMySQLSub(...)
end

---获取GameInstance
function GetGameIns(...)
    return UE4.UGameplayStatics.GetGameInstance(...)
end

---报错信息弹窗
function Err(Message)
    local color =UE4.FColor(255,0,0,255)
    UE4.UUMGLibrary.ShowMessage(Message,color)
end

---警告信息弹窗
function Warning(Message)
    local color =UE4.FColor(255,255,0,255)
    UE4.UUMGLibrary.ShowMessage(Message,color)
end

---打印函数
function print(Message)
    local color =UE4.FColor(0,255,0,255)
    UE4.UUMGLibrary.ShowMessage(Message,color)
end

---获取字符串长度
function GetStringLength(String)
    return UE4.UKismetStringLibrary.Len(String)
    -- body
end
---加载玩家ID
function LoadPlayerID()
    local SaveGameObject=UE4.UGameplayStatics.LoadGameFromSlot("PlayerID",0)
    if SaveGameObject~=nil then
        if SaveGameObject.SavePlayerInfo.ReturnID<1 then
            Err("错误！ 没有存储玩家ID")
            return
        end
        return SaveGameObject.SavePlayerInfo.ReturnID
    end
    Err("加载插槽错误")
end

---保存玩家ID
---@param ID int32 玩家ID
function SavePlayerID(ID)
    local SaveGameObject= UE4.UGameplayStatics.CreateSaveGameObject(USaveGame_Login)
    if SaveGameObject~=nil then
        SaveGameObject.SavePlayerInfo.ReturnID=ID
        UE4.UGameplayStatics.SaveGameToSlot(SaveGameObject,"PlayerID",0)
        print("保存成功")
    end
end

---跳转到游戏服务器
function GoToGameServer(...)
    UE4.UKismetSystemLibrary.ExecuteConsoleCommand(...,"open 127.0.0.1:4399")
end

---跳转到准备关卡
function GoToReadyServer(...)
    UE4.UGameplayStatics.OpenLevel(...,"ReadyMap")
end